home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / program / nwlib15.zip / DEMO.ZIP / STATS.PAS < prev    next >
Pascal/Delphi Source File  |  1996-03-03  |  4KB  |  133 lines

  1. unit Stats;
  2.  
  3. interface
  4.  
  5. uses 
  6.      SysUtils,
  7.      WinTypes, 
  8.      WinProcs, 
  9.      Classes, 
  10.      Graphics, 
  11.      Forms, 
  12.      Controls, 
  13.      Buttons,
  14.      StdCtrls, 
  15.      Gauges, 
  16.      ExtCtrls, 
  17.      NWlib, 
  18.      nwServer,
  19.      nwTools;
  20.  
  21. type
  22.   TwinStats = class(TForm)
  23.     CancelBtn: TBitBtn;
  24.     Timer1: TTimer;
  25.     statPanel: TPanel;
  26.     sftLevel: TEdit;
  27.     ttsLevel: TEdit;
  28.     Label7: TLabel;
  29.     Label8: TLabel;
  30.     serverVer: TEdit;
  31.     Label9: TLabel;
  32.     NumVolumes: TEdit;
  33.     maxConns: TEdit;
  34.     connsInUse: TEdit;
  35.     peakConns: TEdit;
  36.     Label10: TLabel;
  37.     Label11: TLabel;
  38.     Label12: TLabel;
  39.     Label13: TLabel;
  40.     Stats: TGroupBox;
  41.     packetsOut: TEdit;
  42.     upTime: TEdit;
  43.     packetsIn: TEdit;
  44.     Label6: TLabel;
  45.     Label5: TLabel;
  46.     Label1: TLabel;
  47.     Panel2: TPanel;
  48.     gUtilization: TGauge;
  49.     Label2: TLabel;
  50.     cache: TGroupBox;
  51.     cacheHits: TEdit;
  52.     writeBlockCount: TEdit;
  53.     diskWriteCount: TEdit;
  54.     numDirtyCacheHits: TEdit;
  55.     cacheDirtyWaitTime: TEdit;
  56.     cacheMaxConcurrent: TEdit;
  57.     maxByteCount: TEdit;
  58.     minCacheBuffers: TEdit;
  59.     Label14: TLabel;
  60.     Label20: TLabel;
  61.     Label19: TLabel;
  62.     Label18: TLabel;
  63.     Label17: TLabel;
  64.     Label16: TLabel;
  65.     Label15: TLabel;
  66.     Label21: TLabel;
  67.     NWServer1: TNWServer;
  68.     NWTools1: TNWTools;
  69.     NWLib1: TNWLib;
  70.     procedure FormShow(Sender: TObject);
  71.     procedure Timer1Timer(Sender: TObject);
  72.   private
  73.     { Private declarations }
  74.     procedure UpdateStats;
  75.   public
  76.     { Public declarations }
  77.   end;
  78.  
  79. var
  80.   winStats: TwinStats;
  81.  
  82. implementation
  83.  
  84. {$R *.DFM}
  85.  
  86. procedure TwinStats.FormShow(Sender: TObject);
  87.   begin
  88.     updateStats;
  89.   end;
  90.  
  91. procedure TwinStats.UpdateStats;
  92.   var
  93.     serverStats  : TNWServerInfo ;
  94.     memCacheInfo : TNWMemCacheInfo ;
  95.   begin
  96.     { Get Server's Operational & I/O Statistics }
  97.     if getServerStats(GetPrimaryServerID, serverStats) then
  98.       begin
  99.         upTime.Text  := intToStr(serverStats.serverUpTime) ;
  100.         gUtilization.progress := serverStats.utilization ;
  101.         packetsIn.text   := intToStr(serverStats.packetsIn)    ; 
  102.         packetsOut.text  := intToStr(serverStats.packetsOut)   ;
  103.         serverVer.text   := serverStats.version                ;
  104.         sftLevel.text    := intToStr(serverStats.sftlevel)     ;
  105.         ttsLevel.text    := intToStr(serverStats.ttsLevel)     ;
  106.         numVolumes.text  := intToStr(serverStats.numVolumes)   ;
  107.         maxConns.text    := intToStr(serverStats.maxConns)     ;
  108.         connsInUse.text  := intToStr(serverStats.connsInUse)   ;
  109.         peakConns.text   := intToStr(serverStats.maxConnsUsed) ;
  110.       end;
  111.  
  112.     { Retrieve Server's File System Counters }
  113.     if getCacheInfo(GetPrimaryServerID,memCacheInfo) then
  114.       begin
  115.         cacheHits.text          := intToStr(memCacheInfo.numCacheHits)     ;
  116.         writeBlockCount.text    := intToStr(memCacheInfo.writeBlockCount)      ;
  117.         diskWriteCount.text     := intToStr(memCacheInfo.diskWriteCount)    ;
  118.         numDirtyCacheHits.text  := intToStr(memCacheInfo.numDirtyCacheHits) ;
  119.         cacheDirtyWaitTime.text := intToStr(memCacheInfo.cacheDirtyWaitTime);
  120.         cacheMaxConcurrent.text := intToStr(memCacheInfo.cacheMaxConcurrentWrites)    ;
  121.         maxByteCount.text       := intToStr(memCacheInfo.maxByteCount)     ;
  122.         minCacheBuffers.text    := intToStr(memCacheInfo.minCacheBuffers)        ;
  123.       end;
  124.   end;
  125.  
  126.  
  127. procedure TwinStats.Timer1Timer(Sender: TObject);
  128.   begin
  129.     updateStats ;
  130.   end;
  131.  
  132. end.
  133.